package com.polaris.live.utils

import android.os.Bundle
import com.google.firebase.analytics.FirebaseAnalytics
import com.polaris.live.common.cacha.CacheUtil
import com.polaris.live.common.util.LogExt
import com.polaris.live.manager.GooglePayManager

/**
 * FirebaseUtils
 *
 * @author Created by lucas on 2023/11/23 16:54
 */

/**
 * 上报事件
 */
fun FirebaseAnalytics.postEvent(key: String, bundle: Bundle = Bundle()) {
    try {
        bundle.putString("operation_time", CacheUtil.getServerTime().toString())

        logEvent(key, bundle)

        LogExt.logI(GooglePayManager.TAG) {
            "postEvent key = $key bundle = $bundle"
        }
    } catch (t: Throwable) {
        t.printStackTrace()
    }
}